<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <h:head>
        <title>Sunrise Registration</title>
        <h:outputStylesheet library="css" name="main.css"  />
    </h:head>
    <h:body>
        <ui:include src="logo.xhtml" />
        <h:form id="fullPageForm">
            <p:panel header="Sunrise Registration">
                <h:panelGrid columns="3" cellpadding="5">
                    <h:outputLabel for="name" value="Name*:" />
                    <p:inputText id="name" value="#{registrationBean.user.name}" label="Name" >
                        <p:ajax update="namemsg" event="keyup" />
                    </p:inputText>
                    <p:message for="name" id="namemsg"/>
                    
                    <h:outputLabel for="surname" value="Surname*:" />
                    <p:inputText id="surname" value="#{registrationBean.user.surname}" label="Surname" >
                        <p:ajax update="surnamemsg" event="keyup" />
                    </p:inputText>
                    <p:message for="surname" id="surnamemsg"/>

                    <h:outputLabel for="email" value="Email*:" />
                    <p:inputText id="email" value="#{registrationBean.user.email}" label="email" >
                        <p:ajax update="emailmsg" event="blur" />
                        <f:validator validatorId="emailValidator" />
                        
                    </p:inputText>
                    <p:message for="email" id="emailmsg"/>

                    <h:outputLabel for="password" value="Password*:" />
                    <p:password id="password" value="#{registrationBean.user.password}" label="password" match="passwordConfirm">
                        <p:ajax update="passwordmsg" event="blur" />
                    </p:password>
                    <p:message for="password" id="passwordmsg"/>

                    <h:outputLabel for="passwordConfirm" value="Confirm Password*:" />
                    <p:password id="passwordConfirm" value="#{registrationBean.user.password}" label="passwordConfirm">
                        <p:ajax update="passwordmsg" event="blur" />
                    </p:password>
                    <p:message for="password"/>
                    
                    <h:outputLabel for="address" value="Address:" />
                    <p:inputText id="address" value="#{registrationBean.user.address}" label="address" >
                        <p:ajax update="addressmsg" event="keyup" />
                    </p:inputText>
                    <p:message for="address" id="addressmsg"/>

                    <h:outputLabel for="city" value="City:" />
                    <p:inputText id="city" value="#{registrationBean.user.city}" label="city" >
                        <p:ajax update="citymsg" event="keyup" />
                    </p:inputText>
                    <p:message for="city" id="citymsg"/>

                    <h:outputLabel for="country" value="Country:" />
                    <p:inputText id="country" value="#{registrationBean.user.country}" label="country" >
                        <p:ajax update="countrymsg" event="keyup" />
                    </p:inputText>
                    <p:message for="country" id="countrymsg"/>
                </h:panelGrid>

                <div style="clear:both;" />
                <p:commandButton value="Register" ajax="false" validateClient="true" styleClass="ui-priority-primary" style="float:right;"
                                 action="#{registrationBean.register()}"/>
                <div style="clear:both;" />

            </p:panel>
        </h:form>
    </h:body>
</html>

